<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script> 
<script type="text/javascript">
function sum()
{
	var s1 = eval(document.getElementById("txt1").value);
	var s2 = eval(document.getElementById("txt2").value); 
	var s3 = s1+s2;
	if(isNaN(s3)==true)
		document.getElementById("txt3").value = 0;
	else
		document.getElementById("txt3").value = s3;
}
</script>
<script type="text/javascript">
$(document).ready(function(){
    
	$("#txtcoupon").change(function(){
	    var id = $("#txtcoupon").val();
        
		$.ajax({
			type:"get",
			url:"kiemtra.php",
            data:"id="+id,
			async:false,
			success:function(kq){
				$("#status").html(kq);
			}
		})
	})
})
</script>



</head>

<body>
<form id="frm1" name="frm1">
	so thu nhat: <input type="text" id="txt1" name="txt1" onchange="sum()"/>
    	so thu hai: <input type="text" id="txt2" name="txt2" onchange="sum()"/>
        coupon <input type="text" id="txtcoupon" name="txtcoupon" /> <span id="status"></span>
        	tong: <input type="text" id="txt3" name="txt3"/>
</form>
</body>
</html>
